Given an array of integers [x0 x1 x2], how do you calculate all possible permutations from [0 0 0] t

Posted by user319951 on Stack Overflow See other posts from Stack Overflow or by user319951
Published on 2010-04-19T01:44:03Z Indexed on 2010/04/19 1:53 UTC
Read the original article Hit count: 216

Filed under:
|
|
|
|

I am writing a program that takes in an ArrayList and I need to calculate all possible permutations starting with a list of zeroes, up to the value in the corresponding input list.

Does anyone know how to iteratively calculate these values?

For example, given [ 1 2 ] as input, it should find and store the following lists:

[0 0], [1 0], [1 1], [1 2], [0 1], [0 2]

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about permutations